package com.app.jzgdirector.base.presenter;

import rx.Subscription;
import rx.subscriptions.CompositeSubscription;

/**
 * Created by80002037 on 2017/4/14 14:46.
 */

public class BasePresenter {
		protected CompositeSubscription mCompositeSubscription;

		//RXjava取消注册，以避免内存泄露
		public void onUnsubscribe() {
				if (mCompositeSubscription != null && mCompositeSubscription.hasSubscriptions()) {
						mCompositeSubscription.unsubscribe();
				}
		}

		//RXjava注册
		public void addSubscription(Subscription subscriber) {
				if (mCompositeSubscription == null) {
						mCompositeSubscription = new CompositeSubscription();
				}
				mCompositeSubscription.add(subscriber);
		}
}
